home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmdi / mainwindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  5.8 KB  |  200 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
  3.    Copyright (C) 2002,2003 Joseph Wenninger <jowenn@kde.org>
  4.  
  5.    This library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Library General Public
  7.    License as published by the Free Software Foundation; either
  8.    version 2 of the License, or (at your option) any later version.
  9.  
  10.    This library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Library General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Library General Public License
  16.    along with this library; see the file COPYING.LIB.  If not, write to
  17.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.    Boston, MA 02110-1301, USA.
  19.  
  20.    Based on:
  21.  
  22.    //----------------------------------------------------------------------------
  23.    //    Project              : KDE MDI extension
  24.    //
  25.    //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
  26.    //                                         (an IRC application)
  27.    //    changes              : 09/1999       by Falk Brettschneider to create an
  28.    //                           - 06/2000     stand-alone Qt extension set of
  29.    //                                         classes and a Qt-based library
  30.    //                         : 02/2000       by Massimo Morin (mmorin@schedsys.com)
  31.    //                           2000-2003     maintained by the KDevelop project
  32.    //    patches              : -/2000        by Lars Beikirch (Lars.Beikirch@gmx.net)
  33.    //                         : 01/2003       by Jens Zurheide (jens.zurheide@gmx.de)
  34.    //
  35.    //    copyright            : (C) 1999-2003 by Falk Brettschneider
  36.    //                                         and
  37.    //                                         Szymon Stefanek (stefanek@tin.it)
  38.    //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
  39.    //----------------------------------------------------------------------------
  40. */
  41.  
  42. #ifndef _KMDI_MAINWINDOW_H_
  43. #define _KMDI_MAINWINDOW_H_
  44.  
  45. #include <kparts/dockmainwindow.h>
  46. #include <kmenubar.h>
  47. #include <kpopupmenu.h>
  48.  
  49. #include <qptrlist.h>
  50. #include <qrect.h>
  51. #include <qapplication.h>
  52. #include <qguardedptr.h>
  53.  
  54. #include <kmdi/global.h>
  55.  
  56. class QPopupMenu;
  57. class QMenuBar;
  58.  
  59. #include <kmdi/toolviewaccessor.h>
  60.  
  61. namespace KMDIPrivate {
  62.   class MainWindowPrivate;
  63.   class GUIClient;
  64. }
  65.  
  66. namespace KMDI
  67. {
  68.  
  69. class DockContainer;
  70. class TabWidget;
  71.  
  72. class KMDI_EXPORT MainWindow : public KParts::DockMainWindow
  73. {
  74.   Q_OBJECT
  75.  
  76.   friend class KMDI::ToolViewAccessor;
  77.  
  78.   public:
  79.     /**
  80.      * Constructor.
  81.      */
  82.     MainWindow ( QWidget* parentWidget, const char* name = "");
  83.  
  84.     /**
  85.      * Destructor.
  86.      */
  87.     virtual ~MainWindow ();
  88.  
  89.   public:
  90.     /**
  91.      * get the central tabwidget
  92.      * add all your content as child to this widget
  93.      * or as multiple tabs
  94.      * @return tabwidget in central of window
  95.      */
  96.     TabWidget *tabWidget ();
  97.  
  98.     /**
  99.      * Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use
  100.      * the widgetContainer() method for the parent of your newly created widget
  101.      * @return created toolview
  102.      */
  103.     KMDI::ToolViewAccessor *createToolWindow();
  104.  
  105.     /**
  106.      * Usually called from addWindow() when adding a tool view window. It reparents the given widget
  107.      * as toplevel and stay-on-top on the application's main widget.
  108.      * @param pWnd widget for the toolview
  109.      * @param pos docking position
  110.      * @param pTargetWnd
  111.      * @param percent
  112.      * @param tabToolTip
  113.      * @param tabCaption
  114.      * @return created toolview
  115.      */
  116.     KMDI::ToolViewAccessor *addToolWindow( QWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone, QWidget* pTargetWnd = 0L, int percent = 50, const QString& tabToolTip = 0, const QString& tabCaption = 0);
  117.  
  118.     /**
  119.      * delete the toolview belonging to the given accessor
  120.      * @param accessor toolview to delete
  121.      */
  122.     void deleteToolWindow( KMDI::ToolViewAccessor *accessor);
  123.  
  124.     /**
  125.      * delete the toolview belonging to the given pWnd
  126.      * @param pWnd toolview to be deleted
  127.      */
  128.     void deleteToolWindow( QWidget* pWnd);
  129.  
  130.     /**
  131.      * Sets the appearance of the toolview tabs.
  132.      * @param flags See KMDI::ToolviewStyle.
  133.      */
  134.     void setToolViewStyle(int flags);
  135.  
  136.   public slots:
  137.     void prevToolViewInDock();
  138.     void nextToolViewInDock();
  139.  
  140.   signals:
  141.     void collapseOverlapContainers();
  142.  
  143.   protected:
  144.     void findToolViewsDockedToMain(QPtrList<KDockWidget>* list,KDockWidget::DockPosition dprtmw);
  145.     void dockToolViewsIntoContainers(QPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container);
  146.  
  147.   private:
  148.     /**
  149.      * setup main dock + tab widget
  150.      */
  151.     void setupMainDock ();
  152.  
  153.     /**
  154.      * setup the sidebars for the toolviews
  155.      * and other internals to get them working
  156.      */
  157.     void setupToolViews ();
  158.  
  159.     /**
  160.      * setup the menuentries
  161.      * must be done AFTER setupToolViews ()
  162.      */
  163.     void setupGUIClient ();
  164.  
  165.   private slots:
  166.     void setActiveToolDock(DockContainer*);
  167.     void removeFromActiveDockList(DockContainer*);
  168.  
  169.   #define protected public
  170.   signals:
  171.   #undef protected
  172.     void toggleTop();
  173.     void toggleLeft();
  174.     void toggleRight();
  175.     void toggleBottom();
  176.  
  177.   protected:
  178.     KMDIPrivate::GUIClient *m_guiClient;
  179.     QMap <QWidget*, KMDI::ToolViewAccessor*> *m_toolViews;
  180.  
  181.     KDockWidget *m_leftContainer;
  182.     KDockWidget *m_rightContainer;
  183.     KDockWidget *m_topContainer;
  184.     KDockWidget *m_bottomContainer;
  185.  
  186.     KMDI::TabWidget *m_tabWidget;
  187.  
  188.   private:
  189.     /**
  190.      * private d-pointer for BC
  191.      */
  192.     KMDIPrivate::MainWindowPrivate *d;
  193. };
  194.  
  195. }
  196.  
  197. #endif //_MainWindow_H_
  198.  
  199. // kate: space-indent on; indent-width 2; replace-tabs on;
  200.